"""
__author__ = '霍格沃兹测试开发学社'
__desc__ = '更多测试开发技术探讨，请访问：https://ceshiren.com/t/topic/15860'
"""

# from app_practice.PO_pract.page.addmember_page import AddMemberPage
from appium.webdriver.common.appiumby import AppiumBy

from app_practice.PO_pract.frame.base import Base


class EditContactPage(Base):
    _INPUT_NAME = AppiumBy.XPATH, "//*[contains(@text, '姓名')]/../android.widget.EditText"
    _INPUT_PHONE = AppiumBy.XPATH, "//*[contains(@text, '手机')]/..//android.widget.EditText"
    _BTN_SAVE = AppiumBy.XPATH, "//*[@text='保存']"

    def fill_info(self, name, phone_number):
        # 输入姓名，手机号，点击保存
        self.do_send_keys(name, self._INPUT_NAME)
        self.do_send_keys(phone_number, self._INPUT_PHONE)
        # 点击【保存】
        self.do_find(self._BTN_SAVE).click()
        from app_practice.PO_pract.page.addmember_page import AddMemberPage
        return AddMemberPage(self.driver)
